home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CU Amiga Super CD-ROM 22
/
CU Amiga Magazine's Super CD-ROM 22 (1998)(EMAP Images)(GB)[!][issue 1998-05].iso
/
PowerPC
/
Programming
/
PPCTinyProlog
/
prolog.doc
< prev
next >
Wrap
Text File
|
1988-05-26
|
3KB
|
72 lines
VT-PROLOG - Very Tiny Prolog
VT-PROLOG is a simple prolog interpreter provided with full source code
to encourage experimentation with PROLOG.
Loading a data base
1. You may enter rules and queries directlty from the keyboard. The
syntax of both queries and rules is described below. Be sure to
terminate all queries, rules and commands with a period.
2. Data bases may be stored as ASCII text files. To read a text file type
the command:
@ filename .
where filename is a legitimate DOS filename, the default extension is
'PRO'. If the filename contains a ':', '.' or a '\' then it must be
enclosed in single quotes. For example, the following are legitmate
file commands:
@ wine .
@ 'df0:wine.pro' .
@ 'df1:prolog/test/wine' .
3. VTPROLOG will read and compile the text file. Any queries included in
the file will be executed just as if they had been typed from the
keyboard.
4. Data base files may contain commands to read to other data base files.
Terminating VTPROLOG
1. To exit VTPROLOG, type :
EXIT .
Don't forget the period.
VTPROLOG Grammar
The following BNF describes the syntax of VTPROLOG rules and queries:
sentence ::- rule | query | command
rule ::- head '.' | head ':-' tail '.'
query ::- '?-' tail '.'
command ::- '@' file_name '.'
head ::- goal
tail ::- goal | goal ',' tail
goal ::- constant | variable | structure
constant ::- {quoted string} | {token beginning with 'a' .. 'z'}
variable ::- {identifier beginning with 'A' .. 'Z' or '_' }
structure ::- functor '(' component_list ')'
functor ::- {token beginning with 'a' .. 'z'}
component_list ::- term | term ',' component_list
term ::- goal | list
list ::- '[]' | '[' element_list ']'
element_list ::- term | term ',' element_list | term | term
file_name ::- {legitimate DOS file name, must be surrounded with
single quotes if it contains a '.',':' or '\'}
Constant, variable or functor names may be up to 80 characters in
length. Constants beginning with capital letters or containing
imbedded blanks, commas, paraenthesis or periods must be surrounded by
single quote marks. Lists begin with '[' and end with ']'. Components
separated by commas and may be constants variables, structures or other
lists.
Good luck with VTPROLOG. We would be very interested in hearing of
your experiments, enhancements or even (gasp) bugs that you may find.
Please write to us with your comments or questions.
Bill and Bev Thompson
C/O AI Expert Magazine
650 5th St.
Suite 311
San Francisco, CA 94107